package com.gitee.springioc.service.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

import java.beans.PropertyDescriptor;

/**
 * @author ming.yan-1
 * @version V1.0
 * @Title com.gitee.springioc.service.impl
 * @Description
 * @date 2018/9/16  下午12:00
 */
public class OrderInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {

    public static final Log logger = LogFactory.getLog(OrderInstantiationAwareBeanPostProcessor.class);

    @Override
    public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
        logger.info("into OrderInstantiationAwareBeanPostProcessor postProcessBeforeInstantiation method beanName:"+beanName);
        return null;
    }

    @Override
    public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
        logger.info("into OrderInstantiationAwareBeanPostProcessor postProcessAfterInstantiation method beanName:"+beanName);
        return true;
    }


    @Override
    public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
        logger.info("into OrderInstantiationAwareBeanPostProcessor postProcessPropertyValues method beanName:"+beanName);
        return pvs;
    }

}
